import { Controller, QueryParam } from "routing-controllers";
import {JsonController,Get} from "routing-controllers"
import CaptchaService from "../services/CaptchaService";
import Response from "../common/response"
import { Inject } from "typedi";

@JsonController()
export default class Captcha{
    @Inject()
    captahaService:CaptchaService
    /**
     * 图片验证码接口 
     * @param width 验证码图片宽度
     * @param height 验证码图拍高度
     * @param type  math:数学验证码
     */
    @Get("/captcha")
    async get(@QueryParam("width")width=140,@QueryParam("height")height=40,@QueryParam("type")type="math"){
        let data = await this.captahaService.createSvgCode(width,height,type)
        return Response.SUCCESS(data)
    }

}